<form id="add-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">



    <div class="form-group">
        <label for="c-site_id" class="control-label col-xs-12 col-sm-2">{:__('Category')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-category" data-rule="required"  data-source="prize/selectpage"    class="form-control selectpage" name="row[category]" type="text" value=""   onblur="likai(this);">
        </div>
    </div>


    <div class="form-group">
        <label for="c-name" class="control-label col-xs-12 col-sm-2">{:__('Name')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-name" class="form-control" name="row[name]" type="text">
        </div>
    </div>


    <div class="form-group">
        <label for="c-type" class="control-label col-xs-12 col-sm-2">{:__('Type')}:</label>
        <div class="col-xs-12 col-sm-8">
            {foreach name="typeList" item="vo"}
            <label for="row[type]-{$key}"><input id="row[state]-{$key}" name="row[type]" type="radio" value="{$key}"  /> {$vo}</label>
            {/foreach}

        </div>
    </div>

    <div class="form-group">
        <label for="c-percent" class="control-label col-xs-12 col-sm-2">{:__('Percent')}:</label>%
        <div class="col-xs-12 col-sm-8">
            <input id="c-percent" class="form-control" name="row[percent]" type="number"  oninput="likai();" onporpertychange="likai();" >
        </div>
        <p id="shengyu" style="color:red;"></p>
    </div>


    <div class="form-group">
        <label for="c-money" class="control-label col-xs-12 col-sm-2">{:__('Money')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-money" class="form-control" name="row[money]" type="number">
        </div>
    </div>
    <div class="form-group">
        <label for="c-interest" class="control-label col-xs-12 col-sm-2">{:__('Interest')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-interest" data-rule="required" class="form-control" step="" name="row[interest]" type="number" value="">
        </div>
    </div>

    <div class="form-group">
        <label for="c-image" class="control-label col-xs-12 col-sm-2">{:__('Img')}:</label>
        <div class="col-xs-12 col-sm-8">
            <div class="form-inline">
                <input id="c-image" class="form-control" size="50" name="row[img]" type="text" value="">
                <span><button type="button" for="c-prize" id="plupload-image" class="btn btn-danger plupload" data-input-id="c-image"  data-url="{:url('ajax/upload',array('from'=>'prizes'))}" data-input-id="c-prize" data-mimetype="image/*" data-multiple="false" data-preview-id="p-image"><i class="fa fa-upload"></i> {:__('Upload')}</button></span>
                <ul class="row list-inline plupload-preview" id="p-image"></ul>
            </div>
        </div>
    </div>

    <div class="form-group">
        <label for="c-min_amount" class="control-label col-xs-12 col-sm-2">{:__('Min_amount')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-min_amount" class="form-control" name="row[min_amount]" type="number">
        </div>
    </div>
    <div class="form-group">
        <label for="c-starttime" class="control-label col-xs-12 col-sm-2">{:__('Starttime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-starttime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[starttime]" type="text" value="{:date('Y-m-d H:i:s')}">
        </div>
    </div>
    <div class="form-group">
        <label for="c-endtime" class="control-label col-xs-12 col-sm-2">{:__('Endtime')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-endtime" class="form-control datetimepicker" data-date-format="YYYY-MM-DD HH:mm:ss" data-use-current="true" name="row[endtime]" type="text" value="">
        </div>
    </div>
    <div class="form-group">
        <label for="c-order" class="control-label col-xs-12 col-sm-2">{:__('Order')}:</label>
        <div class="col-xs-12 col-sm-8">
            <input id="c-order" class="form-control" name="row[order]" type="number">
        </div>
    </div>



    <div class="form-group">
        <label for="c-content" class="control-label col-xs-12 col-sm-2">{:__('Describe')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="c-content" class="form-control summernote" rows="5" name="row[describe]" cols="50"></textarea>
        </div>
    </div>

    <div class="form-group">
        <label for="c-status" class="control-label col-xs-12 col-sm-2">{:__('Status')}:</label>
        <div class="col-xs-12 col-sm-8">
            <label for="status-1"><input id="status-1" name="row[status]" type="radio" value="1"  checked="checked" /> 有效</label>
            <label for="status-0"><input id="status-0" name="row[status]" type="radio" value="0"   /> 失效</label>
        </div>
    </div>


    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed disabled">{:__('OK')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('Reset')}</button>
        </div>
    </div>
</form>

<script type="text/javascript">

    function likai(e){
        var cate = $('#c-category').val();
        var per = $('#c-percent').val();
        $.post('{:url("prizesetting/tongji")}',
                {cate: cate,per:per,id:0},
                function (data) {
                    if(data.code==1){
                        $('#shengyu').html("剩余中奖比例"+data.num+"%");
                    }
                });
    }

</script>